package com.qiji.video.web.fcontroller;

import com.qiji.video.exception.ServiceException;
import com.qiji.video.service.IVideoDetailService;
import com.qiji.video.util.JwtUtil;
import com.qiji.video.util.Result;
import com.qiji.video.util.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/auth/front/videoDetail")
@Api( tags = "前台----视频细节")
public class VideoDetailController {

    @Autowired
    public IVideoDetailService iVideoDetailService;


    /**
     * 查询排行榜
     */
    @PostMapping("/findLeaderboard")
    @ApiOperation("查询排行榜,partitionId为0则为总榜")
    public Result findLeaderboard(Integer partitionId, Integer num) throws ServiceException {

        return iVideoDetailService.findLeaderboard(partitionId,num);
    }

    /**
     *
     */
    @PostMapping("/findVideoByState")
    @ApiOperation("根据分区；根据状态，状态可以为0，状态为0时仅根据分区查询也就是首页所展示的，否则为点了分区展示的,videoNum查询视频数量")
    public Result findVideoByState(Integer partitionId, Integer stateNum,Integer videoNum) throws ServiceException {

//        return iVideoDetailService.findLeaderboard(partitionId,num);
        return iVideoDetailService.findVideoByState(partitionId,stateNum,videoNum);
    }

}
